<template>
  <div>
  <div id="top">
    <div id="topBar">
      <router-link :to="{name:'getPoints'}"><van-icon name="arrow-left" style="float: left;margin-top: 0.5rem;margin-left: 0.5rem"/>
      <p style="float: left">积分记录</p></router-link>
    </div>
  </div>
    <van-collapse v-model="activeNames" accordion>
      <van-collapse-item name="1">
        <div slot="title" class="title">2019年7月</div>
        <div class="box">
          <div class="item" v-for="item in list">
          <div class="name">
            {{item.name}}
          </div>
            <div class="points">
              {{item.points}}
            </div>
            <div class="date">
              {{item.date}}
            </div>
          </div>
        </div>
      </van-collapse-item>
      <van-collapse-item name="2">
        <div slot="title" class="title">标题1 </div>
        <div class="box">
          <div class="item" v-for="item in list">
            <div class="name">
              {{item.name}}
            </div>
            <div class="points">
              {{item.points}}
            </div>
            <div class="date">
              {{item.date}}
            </div>
          </div>
        </div>
      </van-collapse-item>
      <van-collapse-item name="3">
        <div slot="title" class="title">标题1 </div>
        <div class="box">
          <div class="item" v-for="item in list">
            <div class="name">
              {{item.name}}
            </div>
            <div class="points">
              {{item.points}}
            </div>
            <div class="date">
              {{item.date}}
            </div>
          </div>
        </div>
      </van-collapse-item>
      <van-collapse-item name="4">
        <div slot="title" class="title">标题1 </div>
        <div class="box">
          <div class="item" v-for="item in list">
            <div class="name">
              {{item.name}}
            </div>
            <div class="points">
              {{item.points}}
            </div>
            <div class="date">
              {{item.date}}
            </div>
          </div>
        </div>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>

<script>
    export default {
        name: "pointsRecord",
        data() {
        return {
          title:'2019年7月',
          activeNames:'1',
          list:[{
            name:"地铁出行",
            points:"10积分",
            date:"7月8日 15:28",
          },
            {
              name:"公交出行",
              points:"10积分",
              date:"7月8日 15:28",
            },
            {
              name:"答题积分",
              points:"10积分",
              date:"7月8日 15:28",
            },
            {
              name:"公交出行",
              points:"10积分",
              date:"7月8日 15:28",
            }
            ],
        };
      }
    }
</script>

<style scoped>
  #top{
    width: 100%;
    height:5rem;
    overflow: hidden;
    position: relative;
  }
  #topBar{
    height: 2rem;
    width: 100%;
    line-height: 2rem;
    color:black;
    font-size: 1rem;
    margin-top: 1rem;
  }
  #topBar p{
    display: inline-block;
  }
  .title{
   text-align: left;
    font-size: 1.2rem;
    letter-spacing: 0.1rem;
    color: #39a9ed;
    margin-left:1rem;
  }
  .box{
    padding: 0 0.5rem;
    border: #999999 solid 0.1rem;
    box-sizing: border-box;
  }
  .item{
    height: 3.5rem;
    border-bottom: #999999 solid 0.1rem;
    box-sizing: border-box;
    margin-bottom: -0.1rem;
    padding: 0.4rem 2rem;
    position: relative;
  }
  .name{
   float: left;
    color:black ;
    font-size: 0.9rem;
  }
  .points{
    float: right;
    color:black;
  }
  .date{
    position: absolute;
    bottom: 0.2rem;
    left: 2rem;
  }
</style>
